<template>
  <div class="spring">
    <el-tabs type="border-card">
      <el-tab-pane :label="$t('tabs.spring.configuration')">
        <all-sort-and-search-table
          :columns="springPropertyColumns"
          @getData="getspringPropertyData"
        />
      </el-tab-pane>
      <el-tab-pane :label="$t('tabs.spring.beans')">
        <all-sort-and-search-table :columns="springBeanColumns" @getData="getspringBeanData"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import baseinfoApi from "@/serveapi/baseinfoApi.js";
import AllSortAndSearchTable from "@/components/Table/AllSortAndSearchTable.vue";
import commonUtil from "@/utils/commonUtil.js";
export default {
  components: {
    AllSortAndSearchTable
  },
  data() {
    return {
      springPropertyColumns: [
        {
          key: "key",
          label: "名称",
          width: 230,
          labelEn:'property key'
        },
        {
          key: "value",
          label: "属性",
          labelEn:'property value'
        }
      ],
      springBeanColumns: [
        {
          key: "beanName",
          label: "名称",
          width: 230,
          labelEn:'bean name'
        },
        {
          key: "simpleClassName",
          label: "简类名",
          width: 230,
          labelEn:'simpleClassName'
        },
        {
          key: "beanClassName",
          label: "全类名",
          labelEn:'beanClassName'
        }
      ]
    };
  },
  methods: {
    async getspringPropertyData(setData, searchOver) {
      try {
        let springPropertieMap = await baseinfoApi.getSpringProperties();
        let list = commonUtil.mapToList(springPropertieMap);
        setData(list);
      } finally {
        searchOver();
      }
    },
    async getspringBeanData(setData, searchOver) {
      try {
        let list = await baseinfoApi.getSpringBeans();
        setData(list);
      } finally {
        searchOver();
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.spring {
  margin: 30px;
}
</style>
